package com.example.myproject.repository;

import com.example.myproject.model.ContractAssignment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.List;

@Repository
public interface ContractAssignmentRepository extends JpaRepository<ContractAssignment, Long> {
    // 查询特定合同的所有角色分配
    List<ContractAssignment> findByContractId(Long contractId);


    // 删除特定合同的所有角色分配，支持重新分配
    @Transactional
    void deleteByContractId(Long contractId);

    List<ContractAssignment> findAllByUserId(Long userId);
}

